Skip to content

Queue async ADB commands instead of dropping them during busy operations - #374

Open
Komzpa wants to merge 3 commits into
JeffLIrion:masterfrom
Komzpa:fix/async-command-queue-20261015
Open

Komzpa wants to merge 3 commits into
JeffLIrion:masterfrom
Komzpa:fix/async-command-queue-20261015

Conversation

@Komzpa

@Komzpa Komzpa commented Oct 14, 2026

Copy link
Copy Markdown

ADB commands can be discarded while a screenshot or another valid operation holds the connection lock for more than three seconds. The transport can still be healthy: _acquire raises LockNotAcquiredException before the queued command gets a chance to run. Home Assistant handles that exception by skipping the command.

Wait for the asynchronous connection lock by default. Explicit acquisition deadlines still work, and the ADB transport keeps its existing network timeouts. Cancelling a waiting command leaves the active command’s lock intact.

The regression test holds a real asyncio.Lock beyond the previous three-second limit, then checks that the queued shell command completes after release. It fails with LockNotAcquiredException on the original code. A second test covers cancellation and subsequent connection reuse.

Validation: python -m unittest discover -s tests -t . ran 236 tests successfully (one skipped). Black checks both changed files with the project settings; Flake8 checks the changed source file.

Komzpa and others added 3 commits October 15, 2026 02:09
…e lint matrix

The requirement was a bare `black`, so each CI Python resolved a different
release (23.3.0 on 3.7 ... 26.10.1 on 3.10-3.12) and the newest normalizes
androidtv/exceptions.py's module docstring value, which the repo's own
formatting cannot absorb without a literal change. 23.3.0 is the newest
release that still supports the maintained Python 3.7 leg and it leaves
package, tests, and setup.py clean as authored.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant